<!DOCTYPE html>
<title>Test video controls visibility on touch. After a delay the controls must be hidden.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video controls loop></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.oncanplaythrough = t.step_func(function() {
        assert_true(video.paused);

        // Tap the play button
        var coords = elementCoordinates(enabledPlayButton(video));
        eventSender.gestureTapDown(coords[0], coords[1]);
        eventSender.gestureShowPress(coords[0], coords[1]);
        eventSender.gestureTap(coords[0], coords[1]);
        assert_false(video.paused);

        runAfterHideMediaControlsTimerFired(t.step_func_done(function() {
            var controls = mediaControlsButton(video, "panel");
            assert_true(controls.classList.contains("transparent"));
        }), video);
    });

    video.src = "content/test.ogv";
});
</script>
